<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/share/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>开通系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%@ include file="/WEB-INF/share/wechat.jsp"%>
<script type="text/javascript">
	var errorcode = '${errorcode}';
	if (errorcode) {
		alert('支付错误:' + errorcode);
		history.go(-1);
	}
	//调用微信JS api 支付
	function jsApiCall() {
		WeixinJSBridge.invoke('getBrandWCPayRequest', {
			"appId" : "${appId}",
			"nonceStr" : "${nonceStr}",
			"package" : "prepay_id=${payid}",
			"signType" : "${signType}",
			"timeStamp" : "${timeStamp}",
			"paySign" : "${paySign}"
		}, function(res) {
			if (res.err_msg == "get_brand_wcpay_request:ok") {
				window.location.href = "${ctx}/wx/xh";
			} else {
				//alert(res.errMsg);
				alert(res.err_code+res.err_desc+res.err_msg);
			}
		});
	}
	function callpay() {
		if (typeof WeixinJSBridge == "undefined") {
			if (document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', jsApiCall,
						false);
			} else if (document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', jsApiCall);
				document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
			}
		} else {
			jsApiCall();
		}
	}
</script>
<script>
	var contentPath = '${ctx}';
</script>
</head>
<body>
	<%@ include file="/WEB-INF/share/wechattop.jsp"%>
	<div class="mui-content">
		<div class="mui-control-content mui-active">
			<div class="mui-content">
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>套餐类型:</label> <label>速成套餐</label>
					</div>
					<div class="mui-input-row">
						<label>金额:</label> <label>${money}元</label>
					</div>
					<div class="mui-button-row">
						<button type="button" class="mui-btn mui-btn-primary"
							onclick="callpay()">立即支付</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	<%@ include file="/WEB-INF/share/wechatscript.jsp"%>
</body>
</html>
